package com.wlsk.license.controller;

import com.wlsk.license.common.result.Result;
import com.wlsk.license.service.ITestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;

@Slf4j
@RestController
@AllArgsConstructor
@Api(tags = "测试服务API")
public class TestController {

    @Autowired
    private ITestService testService;

    @ApiOperation(value = "测试获取乘客信息")
    @GetMapping("/test")
    public Result<Void> testPassengerSession() {
        testService.test();
        return Result.success();
    }

    @ApiOperation(value = "项目根目录")
    @GetMapping("/rootPath")
    public Result<String> rootPath() {
        // 获取项目根目录
        String rootPath = new File("").getAbsolutePath();
        log.info("项目根目录:{}", rootPath);
        return Result.success(rootPath);
    }
}
